<template>
  <div>
    <!-- 三级联动全局组件，不用在这引入 -->
    <TypeNav />
    <ListContainer />
    <Recommend />
    <Rank />
    <Like />
    <!-- Floor这个组件:自己在组件内部是没有发请求的，数据是父组件给的,在组件编译之前，数据就传进去了 -->
    <Fllor v-for="(floor, index) in floorList" :key="floor.id" :list="floor" />
    <Brand />
  </div>
</template>
<script>
//引入其余组件
import ListContainer from "@/pages/Home/ListContainer";
import Recommend from "@/pages/Home/Recommend";
import Rank from "@/pages/Home/Rank";
import Like from "@/pages/Home/Like";
import Fllor from "@/pages/Home/Fllor";
import Brand from "@/pages/Home/Brand";
import { mapState } from "vuex";
export default {
  name: "home",
  components: {
    ListContainer,
    Recommend,
    Rank,
    Like,
    Fllor,
    Brand,
  },
  async mounted() {
    //派发action，获取数据，给floor用,用的也是mock
    this.$store.dispatch("getFloorList");
  },
  computed: {
    ...mapState({
      floorList: (state) => state.home.floorList,
    }),
  },
};
</script>
<style>
</style>